<template>
	<view>
		<view class="top">
			<view class="topCont">
				<view class="score">1020</view>
				<view class="btn">当前积分</view>
			</view>
		</view>
		<view class="cont">
			<view class="tab">
				<view class="tabItem" :class="{'tabItem_active':tabIndex == index}" v-for="(item,index) in tabList" :key="index"
				 @tap="switchTab(index)">{{item}}</view>
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in list" :key="index">
					<view class="item-left">
						<view class="item-left-name">{{item.name}}</view>
						<view class="item-left-time">{{item.time}}</view>
					</view>
					<view class="item-right">{{item.score}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabIndex: 0, //选项卡索引
				tabList: ['全部', '收入', '支出'], //选项卡列表
				list: [{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				},{
					name: '签到',
					time: '2020-12-21',
					score: 12
				}]
			}
		},
		methods: {
			// 切换选项卡
			switchTab(index) {
				if (this.tabIndex != index) {
					this.tabIndex = index;
				}
			},
		}
	}
</script>

<style>
	.top {
		width: 100%;
		height: 480upx;
		background: linear-gradient(360deg, rgba(255, 255, 255, 1) 0%, rgba(246, 216, 160, 1) 45%, #EFC683 100%);
		position: fixed;
		left: 0;
		/* #ifdef H5 */
		top: 88upx;
		/* #endif */
		/* #ifndef H5 */
		top: 0;
		/* #endif */
		z-index: 9;
	}

	.topCont {
		width: 310upx;
		height: 310upx;
		line-height: 310upx;
		text-align: center;
		background-size: 100%;
		background-repeat: no-repeat;
		background-image: url(../../static/img/integralBg.png);
		position: absolute;
		top: 72upx;
		left: 220upx;
	}

	.score {
		color: #AE7A1F;
		font-size: 52upx;
		white-space: nowrap;
	}

	.btn {
		color: #AE7A1F;
		width: 150upx;
		height: 52upx;
		text-align: center;
		line-height: 52upx;
		background-color: #E6B873;
		margin: -100upx auto 0;
		border-radius: 52upx;
	}

	.cont {
		border-radius: 10upx 10upx 0px 0px;
	}

	.tab {
		width: calc(100% - 60upx);
		border-radius: 10upx 10upx 0px 0px;
		border-bottom: 2upx solid #E7E7E7;
		left: 30upx;
		/* #ifdef H5 */
		top: 472upx;
		/* #endif */
		/* #ifndef H5 */
		top: 384upx;
		/* #endif */
	}

	.list {
		position: absolute;
		top: 480upx;
		left: 30upx;
		right: 30upx;
		width: calc(100% - 60upx);
		padding-bottom: 100upx;
	}

	.item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30upx;
		width: calc(100% - 60upx);
		border-top: 2upx solid #E7E7E7;
		background-color: #FFFFFF;
	}

	.item:first-child {
		border-top: none;
	}

	.item-left {
		width: 85%;
	}

	.item-left-name {
		word-break: break-word;
	}

	.item-left-time {
		color: #999999;
		font-size: 24upx;
		margin-top: 30upx;
	}

	.item-right {
		color: #E6B873;
	}
</style>
